using System;
using System.Collections.Generic;
using System.Reflection;

namespace Mistral
{
	public class CmdParamManager
	{
		List<CmdParam> _params = new List<CmdParam>();
		
		public void Register( CmdParam cmdParam )
		{
			_params.Add( cmdParam );
		}

		public void Register( Type paramsContainerType )
		{
			FieldInfo[] fields = paramsContainerType.GetFields( BindingFlags.Public | BindingFlags.Static );
			foreach ( FieldInfo fieldInfo in fields )
			{
				if( fieldInfo.FieldType == typeof(CmdParam) )
				{
					CmdParam cmdParam = fieldInfo.GetValue( null ) as CmdParam;
					if( cmdParam != null )
						Register( cmdParam );
				}
			}
		}

		public void Help()
		{
			foreach( CmdParam param in _params )
			{
				Console.WriteLine( param );
			}
		}
	}
}